//用户相关请求模块
import request from "@/utils/request";


//登录注册
export const login=(data)=>{
  return request.post('/v1_0/authorizations', data)
}
export const sendSms = (mobile) => {
  return request.get(`/v1_0/sms/codes/${mobile}`)
}
export const getUserInfo=()=>{
   return request({
      method:'get',
      url:'/v1_0/user'
   })
}

/*
   获取用户频道列表
*/
export const getUserChannels=()=>{
    return request({
        method:'get',
        url:'/v1_0/user/channels'
    })
}

/*用户关注*/
export const addFollow=target =>{
    return request({
        method:'POST',
        url:'/v1_0/user/followings',
        data:{
           target
        }
    })
}
/*用户取消关注*/
export const delFollow=target=>{
    return request({
        method:'DELETE',
        url:`/v1_0/user/followings/${target}`
    })
}


//获取用户个人资料
export const getUserProfile=()=>{
    return request({
        method:'GET',
        url:'/v1_0/user/profile'
    })
}

//编辑用户个人资料
export const UserProfile=(data)=>{
    return request({
        method:'PATCH',
        url:'/v1_0/user/profile',
        data
    })
}

//修改用户照片资料
export const UserPhoto=(data)=>{
    return request({
        method:'PATCH',
        url:'/v1_0/user/photo',
        data
    })
}
